//
//  YoungAllData.m
//  DA_V
//
//  Created by 周季阳 on 15/5/13.
//  Copyright (c) 2015年 zhouhai. All rights reserved.
//

#import "YoungAllData.h"
#import "AFHTTPRequestOperationManager.h"
#import "EncryptionData.h"
#import "JSONKit.h"

@implementation YoungAllData

#pragma mark - 获取信息列表
-(void)gainInfo:(NSString *)AgentID andPageID:(NSString *)PageID andPerPage:(NSString *)PerPage{
    AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
    manager.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/html"];
    
    //NSMutableArray *array = [[NSMutableArray alloc]init];
    NSMutableDictionary *  smallGoodsDic = [NSMutableDictionary dictionaryWithCapacity:1];
    
    [smallGoodsDic setObject:AgentID forKey:@"AgentID"];
    [smallGoodsDic setObject:PageID forKey:@"PageID"];
    [smallGoodsDic setObject:PerPage forKey:@"PerPage"];
    //[array addObject:smallGoodsDic];
    NSData *jsonData = [NSJSONSerialization dataWithJSONObject:smallGoodsDic options:NSJSONWritingPrettyPrinted error:nil];
    
    NSString *jsonString = [jsonData base64EncodedStringWithOptions:0];
    
    // EncryptionData *data  = [[EncryptionData alloc]init];
    NSString *str = [self encodeString:jsonString :@"hotkeycuk"];
    
    NSDictionary *paramer = @{@"sign":str};
    
    NSString *urls = [NSString stringWithFormat:@"http://api.dw521.com/api/profile/notice.php"];
    [manager POST:urls parameters:paramer success:^(AFHTTPRequestOperation *operation, id responseObject) {
        
        NSLog(@"登录信息responseObject=%@",responseObject);
        EncryptionData *encryption = [[EncryptionData alloc]init];
        NSString * str =[encryption decryption:[responseObject objectForKey:@"sign"] :@"hotkeycuk"];
        NSDictionary *dic = [str objectFromJSONString];
        [self.delegate info:dic];
    
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        [self.delegate requistFail];
    }];
    
}
#pragma mark - 获取信息详情
-(void)gainInfoDetails:(NSString *)AgentID andNoticeID:(NSString *)NoticeID{
    AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
    manager.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/html"];
    
    //NSMutableArray *array = [[NSMutableArray alloc]init];
    NSMutableDictionary *  smallGoodsDic = [NSMutableDictionary dictionaryWithCapacity:1];
    
    [smallGoodsDic setObject:AgentID forKey:@"AgentID"];
    [smallGoodsDic setObject:NoticeID forKey:@"NoticeID"];
    //[array addObject:smallGoodsDic];
    NSData *jsonData = [NSJSONSerialization dataWithJSONObject:smallGoodsDic options:NSJSONWritingPrettyPrinted error:nil];
    
    NSString *jsonString = [jsonData base64EncodedStringWithOptions:0];
    
    // EncryptionData *data  = [[EncryptionData alloc]init];
    NSString *str = [self encodeString:jsonString :@"hotkeycuk"];
    
    NSDictionary *paramer = @{@"sign":str};
    
    NSString *urls = [NSString stringWithFormat:@"http://api.dw521.com/api/profile/notice.php?action=detail"];
    [manager POST:urls parameters:paramer success:^(AFHTTPRequestOperation *operation, id responseObject) {
        
        NSLog(@"登录信息responseObject=%@",responseObject);
        EncryptionData *encryption = [[EncryptionData alloc]init];
        NSString * str =[encryption decryption:[responseObject objectForKey:@"sign"] :@"hotkeycuk"];
        NSDictionary *dic = [str objectFromJSONString];
        [self.delegate infoDetails:dic];
      
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        [self.delegate requistFail];
    }];
}

#pragma mark - 微商账户信息
-(void)gainUserInfo:(NSString *)AgentID{
    AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
    manager.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/html"];
    
    //NSMutableArray *array = [[NSMutableArray alloc]init];
    NSMutableDictionary *  smallGoodsDic = [NSMutableDictionary dictionaryWithCapacity:1];
    
    [smallGoodsDic setObject:AgentID forKey:@"AgentID"];
    //[array addObject:smallGoodsDic];
    NSData *jsonData = [NSJSONSerialization dataWithJSONObject:smallGoodsDic options:NSJSONWritingPrettyPrinted error:nil];
    
    NSString *jsonString = [jsonData base64EncodedStringWithOptions:0];
    
    // EncryptionData *data  = [[EncryptionData alloc]init];
    NSString *str = [self encodeString:jsonString :@"hotkeycuk"];
    
    NSDictionary *paramer = @{@"sign":str};
    
    NSString *urls = [NSString stringWithFormat:@"http://api.dw521.com/api/profile/account.php"];
    [manager POST:urls parameters:paramer success:^(AFHTTPRequestOperation *operation, id responseObject) {
        
        NSLog(@"登录信息responseObject=%@",responseObject);
        EncryptionData *encryption = [[EncryptionData alloc]init];
        NSString * str =[encryption decryption:[responseObject objectForKey:@"sign"] :@"hotkeycuk"];
        NSDictionary *dic = [str objectFromJSONString];
        [self.delegate userInfo:dic];
   
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        [self.delegate requistFail];
    }];
}

#pragma mark - 是否有申请升级的机会
-(void)isUpgrade:(NSString *)AgentID{
    AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
    manager.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/html"];
    
    //NSMutableArray *array = [[NSMutableArray alloc]init];
    NSMutableDictionary *  smallGoodsDic = [NSMutableDictionary dictionaryWithCapacity:1];
    
    [smallGoodsDic setObject:AgentID forKey:@"AgentID"];
    //[array addObject:smallGoodsDic];
    NSData *jsonData = [NSJSONSerialization dataWithJSONObject:smallGoodsDic options:NSJSONWritingPrettyPrinted error:nil];
    
    NSString *jsonString = [jsonData base64EncodedStringWithOptions:0];
    
    // EncryptionData *data  = [[EncryptionData alloc]init];
    NSString *str = [self encodeString:jsonString :@"hotkeycuk"];
    
    NSDictionary *paramer = @{@"sign":str};
    
    NSString *urls = [NSString stringWithFormat:@"http://api.dw521.com/api/profile/applychance.php"];
    [manager POST:urls parameters:paramer success:^(AFHTTPRequestOperation *operation, id responseObject) {
        
        NSLog(@"登录信息responseObject=%@",responseObject);
        EncryptionData *encryption = [[EncryptionData alloc]init];
        NSString * str =[encryption decryption:[responseObject objectForKey:@"sign"] :@"hotkeycuk"];
        NSDictionary *dic = [str objectFromJSONString];
        [self.delegate isUpgrade:dic];
   
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        [self.delegate requistFail];
    }];
}

#pragma mark - 提现
-(void)goWithdraw:(NSString *)AgentID andAmount:(NSString *)Amount andTradePass:(NSString *)TradePass{
    AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
    manager.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/html"];
    
    //NSMutableArray *array = [[NSMutableArray alloc]init];
    NSMutableDictionary *  smallGoodsDic = [NSMutableDictionary dictionaryWithCapacity:1];
    
    [smallGoodsDic setObject:AgentID forKey:@"AgentID"];
    [smallGoodsDic setObject:Amount forKey:@"Amount"];
    [smallGoodsDic setObject:TradePass forKey:@"TradePass"];

    //[array addObject:smallGoodsDic];
    NSData *jsonData = [NSJSONSerialization dataWithJSONObject:smallGoodsDic options:NSJSONWritingPrettyPrinted error:nil];
    
    NSString *jsonString = [jsonData base64EncodedStringWithOptions:0];
    
    // EncryptionData *data  = [[EncryptionData alloc]init];
    NSString *str = [self encodeString:jsonString :@"hotkeycuk"];
    
    NSDictionary *paramer = @{@"sign":str};
    
    NSString *urls = [NSString stringWithFormat:@"http://api.dw521.com/api/profile/withdraw.php"];
    [manager POST:urls parameters:paramer success:^(AFHTTPRequestOperation *operation, id responseObject) {
        
        NSLog(@"登录信息responseObject=%@",responseObject);
        EncryptionData *encryption = [[EncryptionData alloc]init];
        NSString * str =[encryption decryption:[responseObject objectForKey:@"sign"] :@"hotkeycuk"];
        NSDictionary *dic = [str objectFromJSONString];
        [self.delegate withdraw:dic];
       
        
        
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        [self.delegate requistFail];
    }];
}

#pragma mark - 提现记录
-(void)gainWithdrawRecord:(NSString *)AgentID andPageID:(NSString *)PageID andPerPage:(NSString *)PerPage andStartTime:(NSString *)StartTime andEndTime:(NSString *)EndTime{
    AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
    manager.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/html"];
    
    //NSMutableArray *array = [[NSMutableArray alloc]init];
    NSMutableDictionary *  smallGoodsDic = [NSMutableDictionary dictionaryWithCapacity:1];
    
    [smallGoodsDic setObject:AgentID forKey:@"AgentID"];
    [smallGoodsDic setObject:PageID forKey:@"PageID"];
    [smallGoodsDic setObject:PerPage forKey:@"PerPage"];
    [smallGoodsDic setObject:StartTime forKey:@"StartTime"];
    [smallGoodsDic setObject:EndTime forKey:@"EndTime"];
    //[array addObject:smallGoodsDic];
    NSData *jsonData = [NSJSONSerialization dataWithJSONObject:smallGoodsDic options:NSJSONWritingPrettyPrinted error:nil];
    
    NSString *jsonString = [jsonData base64EncodedStringWithOptions:0];
    
    // EncryptionData *data  = [[EncryptionData alloc]init];
    NSString *str = [self encodeString:jsonString :@"hotkeycuk"];
    
    NSDictionary *paramer = @{@"sign":str};
    
    NSString *urls = [NSString stringWithFormat:@"http://api.dw521.com/api/profile/withdraw.php?action=record"];
    [manager POST:urls parameters:paramer success:^(AFHTTPRequestOperation *operation, id responseObject) {
        EncryptionData *encryption = [[EncryptionData alloc]init];
        NSString * str =[encryption decryption:[responseObject objectForKey:@"sign"] :@"hotkeycuk"];
        NSDictionary *dic = [str objectFromJSONString];
        if (PageID.intValue > 1) {
            
             [self.delegate shanglaRecord:dic];
        } else{
        [self.delegate withdrawRecord:dic];
        }
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        [self.delegate requistFail];
    }];
    
}

#pragma mark - 修改密码
-(void)updataPassword:(NSString *)AgentID andLoginPass:(NSString *)LoginPass andNewLoginPass:(NSString *)NewLoginPass andReLoginPass:(NSString *)ReLoginPass{
    AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
    manager.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/html"];
    
    //NSMutableArray *array = [[NSMutableArray alloc]init];
    NSMutableDictionary *  smallGoodsDic = [NSMutableDictionary dictionaryWithCapacity:1];
    
    [smallGoodsDic setObject:AgentID forKey:@"AgentID"];
    [smallGoodsDic setObject:LoginPass forKey:@"LoginPass"];
    [smallGoodsDic setObject:NewLoginPass forKey:@"NewLoginPass"];
    [smallGoodsDic setObject:ReLoginPass forKey:@"ReLoginPass"];
    
    //[array addObject:smallGoodsDic];
    NSData *jsonData = [NSJSONSerialization dataWithJSONObject:smallGoodsDic options:NSJSONWritingPrettyPrinted error:nil];
    
    NSString *jsonString = [jsonData base64EncodedStringWithOptions:0];
    
    // EncryptionData *data  = [[EncryptionData alloc]init];
    NSString *str = [self encodeString:jsonString :@"hotkeycuk"];
    
    NSDictionary *paramer = @{@"sign":str};
    
    NSString *urls = [NSString stringWithFormat:@"http://api.dw521.com/api/profile/password.php"];
    [manager POST:urls parameters:paramer success:^(AFHTTPRequestOperation *operation, id responseObject) {
        
        NSLog(@"登录信息responseObject=%@",responseObject);
        EncryptionData *encryption = [[EncryptionData alloc]init];
        NSString * str =[encryption decryption:[responseObject objectForKey:@"sign"] :@"hotkeycuk"];
        NSDictionary *dic = [str objectFromJSONString];
        [self.delegate updataPassword:dic];
     
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        [self.delegate requistFail];
    }];
}
#pragma mark - 缺货报警
-(void)productWarning:(NSString *)AgentID{
    AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
    manager.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/html"];
    
    //NSMutableArray *array = [[NSMutableArray alloc]init];
    NSMutableDictionary *  smallGoodsDic = [NSMutableDictionary dictionaryWithCapacity:1];
    
    [smallGoodsDic setObject:AgentID forKey:@"AgentID"];
    
    //[array addObject:smallGoodsDic];
    NSData *jsonData = [NSJSONSerialization dataWithJSONObject:smallGoodsDic options:NSJSONWritingPrettyPrinted error:nil];
    
    NSString *jsonString = [jsonData base64EncodedStringWithOptions:0];
    
    // EncryptionData *data  = [[EncryptionData alloc]init];
    NSString *str = [self encodeString:jsonString :@"hotkeycuk"];
    
    NSDictionary *paramer = @{@"sign":str};
    
    NSString *urls = [NSString stringWithFormat:@"http://api.dw521.com/api/product/stock.php?action=warning"];
    [manager POST:urls parameters:paramer success:^(AFHTTPRequestOperation *operation, id responseObject) {
        
        NSLog(@"登录信息responseObject=%@",responseObject);
        EncryptionData *encryption = [[EncryptionData alloc]init];
        NSString * str =[encryption decryption:[responseObject objectForKey:@"sign"] :@"hotkeycuk"];
        NSDictionary *dic = [str objectFromJSONString];
        [self.delegate productWarning:dic];
      
        
        
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        [self.delegate requistFail];
    }];
}
#pragma mark - 商品库存
-(void)productStock:(NSString *)AgentID andCategoryID:(NSString *)CategoryID{
    AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
    manager.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/html"];
    
    //NSMutableArray *array = [[NSMutableArray alloc]init];
    NSMutableDictionary *  smallGoodsDic = [NSMutableDictionary dictionaryWithCapacity:1];
    
    [smallGoodsDic setObject:AgentID forKey:@"AgentID"];
    [smallGoodsDic setObject:CategoryID forKey:@"CategoryID"];
    
    //[array addObject:smallGoodsDic];
    NSData *jsonData = [NSJSONSerialization dataWithJSONObject:smallGoodsDic options:NSJSONWritingPrettyPrinted error:nil];
    
    NSString *jsonString = [jsonData base64EncodedStringWithOptions:0];
    
    // EncryptionData *data  = [[EncryptionData alloc]init];
    NSString *str = [self encodeString:jsonString :@"hotkeycuk"];
    
    NSDictionary *paramer = @{@"sign":str};
    
    NSString *urls = [NSString stringWithFormat:@"http://api.dw521.com/api/product/stock.php"];
    [manager POST:urls parameters:paramer success:^(AFHTTPRequestOperation *operation, id responseObject) {
        
        NSLog(@"登录信息responseObject=%@",responseObject);
        EncryptionData *encryption = [[EncryptionData alloc]init];
        NSString * str =[encryption decryption:[responseObject objectForKey:@"sign"] :@"hotkeycuk"];
        NSDictionary *dic = [str objectFromJSONString];
            [self.delegate productStock:dic];
      
        
        
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        [self.delegate requistFail];
    }];
}

#pragma mark - 培训列表
-(void)gainTrain:(NSString *)PageID andPerPage:(NSString *)PerPage{
    AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
    manager.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/html"];
    
    //NSMutableArray *array = [[NSMutableArray alloc]init];
    NSMutableDictionary *  smallGoodsDic = [NSMutableDictionary dictionaryWithCapacity:1];
    
    [smallGoodsDic setObject:PageID forKey:@"PageID"];
    [smallGoodsDic setObject:PerPage forKey:@"PerPage"];
    
    //[array addObject:smallGoodsDic];
    NSData *jsonData = [NSJSONSerialization dataWithJSONObject:smallGoodsDic options:NSJSONWritingPrettyPrinted error:nil];
    
    NSString *jsonString = [jsonData base64EncodedStringWithOptions:0];
    
    // EncryptionData *data  = [[EncryptionData alloc]init];
    NSString *str = [self encodeString:jsonString :@"hotkeycuk"];
    
    NSDictionary *paramer = @{@"sign":str};
    
    NSString *urls = [NSString stringWithFormat:@"http://api.dw521.com/api/profile/train.php"];
    [manager POST:urls parameters:paramer success:^(AFHTTPRequestOperation *operation, id responseObject) {
        
        NSLog(@"登录信息responseObject=%@",responseObject);
        EncryptionData *encryption = [[EncryptionData alloc]init];
        NSString * str =[encryption decryption:[responseObject objectForKey:@"sign"] :@"hotkeycuk"];
        NSDictionary *dic = [str objectFromJSONString];
            [self.delegate train:dic];
       
        
        
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        [self.delegate requistFail];
    }];
}

#pragma mark - 培训内容
-(void)gainTrainDetails:(NSString *)CourseID{
    AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
    manager.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/html"];
    
    //NSMutableArray *array = [[NSMutableArray alloc]init];
    NSMutableDictionary *  smallGoodsDic = [NSMutableDictionary dictionaryWithCapacity:1];
    
    [smallGoodsDic setObject:CourseID forKey:@"CourseID"];
    
    //[array addObject:smallGoodsDic];
    NSData *jsonData = [NSJSONSerialization dataWithJSONObject:smallGoodsDic options:NSJSONWritingPrettyPrinted error:nil];
    
    NSString *jsonString = [jsonData base64EncodedStringWithOptions:0];
    
    // EncryptionData *data  = [[EncryptionData alloc]init];
    NSString *str = [self encodeString:jsonString :@"hotkeycuk"];
    
    NSDictionary *paramer = @{@"sign":str};
    
    NSString *urls = [NSString stringWithFormat:@"http://api.dw521.com/api/profile/train.php?action=detail"];
    [manager POST:urls parameters:paramer success:^(AFHTTPRequestOperation *operation, id responseObject) {
        
        NSLog(@"登录信息responseObject=%@",responseObject);
        EncryptionData *encryption = [[EncryptionData alloc]init];
        NSString * str =[encryption decryption:[responseObject objectForKey:@"sign"] :@"hotkeycuk"];
        NSDictionary *dic = [str objectFromJSONString];
            [self.delegate trainDetails:dic];
       
        
        
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        [self.delegate requistFail];
    }];
}
#pragma mark - 获取商品类型
-(void)gainGetType{
    AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
    manager.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/html"];
    
    
    NSString *urls = [NSString stringWithFormat:@"http://api.dw521.com/api/product/gettype.php"];
    [manager POST:urls parameters:nil success:^(AFHTTPRequestOperation *operation, id responseObject) {
        
        NSLog(@"登录信息responseObject=%@",responseObject);
        EncryptionData *encryption = [[EncryptionData alloc]init];
        NSString * str =[encryption decryption:[responseObject objectForKey:@"sign"] :@"hotkeycuk"];
        NSDictionary *dic = [str objectFromJSONString];
        [self.delegate getType:dic];
       
        
        
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        [self.delegate requistFail];
    }];
}
#pragma mark - 获取推广素材
-(void)gainPromotion:(NSString *)ProductID andPageID:(NSString *)PageID andPerPage:(NSString *)PerPage{
    AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
    manager.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/html"];
    
    //NSMutableArray *array = [[NSMutableArray alloc]init];
    NSMutableDictionary *  smallGoodsDic = [NSMutableDictionary dictionaryWithCapacity:1];
    
    [smallGoodsDic setObject:ProductID forKey:@"ProductID"];
    [smallGoodsDic setObject:PageID forKey:@"PageID"];
    [smallGoodsDic setObject:PerPage forKey:@"PerPage"];
    
    //[array addObject:smallGoodsDic];
    NSData *jsonData = [NSJSONSerialization dataWithJSONObject:smallGoodsDic options:NSJSONWritingPrettyPrinted error:nil];
    
    NSString *jsonString = [jsonData base64EncodedStringWithOptions:0];
    
    // EncryptionData *data  = [[EncryptionData alloc]init];
    NSString *str = [self encodeString:jsonString :@"hotkeycuk"];
    
    NSDictionary *paramer = @{@"sign":str};
    
    NSString *urls = [NSString stringWithFormat:@"http://api.dw521.com/api/profile/promotion.php"];
    [manager POST:urls parameters:paramer success:^(AFHTTPRequestOperation *operation, id responseObject) {
        
        NSLog(@"登录信息responseObject=%@",responseObject);
        EncryptionData *encryption = [[EncryptionData alloc]init];
        NSString * str =[encryption decryption:[responseObject objectForKey:@"sign"] :@"hotkeycuk"];
        NSDictionary *dic = [str objectFromJSONString];
            [self.delegate promotion:dic];
        
        
        
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        [self.delegate requistFail];
    }];
}
#pragma mark - 下线管理
-(void)gainChildren:(NSString *)AgentID andLevel:(NSString *)Level andSearchKey:(NSString *)SearchKey andSearchValue:(NSString *)SearchValue andSortKey:(NSString *)SortKey andSortValue:(NSString *)SortValue andPage:(NSString *)Page andPerPage:(NSString *)PerPage{
    AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
    manager.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/html"];
    
    //NSMutableArray *array = [[NSMutableArray alloc]init];
    NSMutableDictionary *  smallGoodsDic = [NSMutableDictionary dictionaryWithCapacity:1];
    
    [smallGoodsDic setObject:AgentID forKey:@"AgentID"];
    [smallGoodsDic setObject:Level forKey:@"Level"];
    [smallGoodsDic setObject:SearchKey forKey:@"SearchKey"];
    [smallGoodsDic setObject:SearchValue forKey:@"SearchValue"];
    [smallGoodsDic setObject:SortKey forKey:@"SortKey"];
    [smallGoodsDic setObject:SortValue forKey:@"SortValue"];
    [smallGoodsDic setObject:Page forKey:@"Page"];
    [smallGoodsDic setObject:PerPage forKey:@"PerPage"];
    
    //[array addObject:smallGoodsDic];
    NSData *jsonData = [NSJSONSerialization dataWithJSONObject:smallGoodsDic options:NSJSONWritingPrettyPrinted error:nil];
    
    NSString *jsonString = [jsonData base64EncodedStringWithOptions:0];
    
    // EncryptionData *data  = [[EncryptionData alloc]init];
    NSString *str = [self encodeString:jsonString :@"hotkeycuk"];
    
    NSDictionary *paramer = @{@"sign":str};
    
    NSString *urls = [NSString stringWithFormat:@"http://api.dw521.com/api/profile/children.php"];
    [manager POST:urls parameters:paramer success:^(AFHTTPRequestOperation *operation, id responseObject) {
        
        NSLog(@"登录信息responseObject=%@",responseObject);
        EncryptionData *encryption = [[EncryptionData alloc]init];
        NSString * str =[encryption decryption:[responseObject objectForKey:@"sign"] :@"hotkeycuk"];
        NSDictionary *dic = [str objectFromJSONString];
        [self.delegate children:dic];
        
        
        
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        [self.delegate requistFail];
    }];
}

#pragma mark - 微商下线明细
-(void)gainChildrenDetails:(NSString *)AgentID{
    AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
    manager.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/html"];
    
    //NSMutableArray *array = [[NSMutableArray alloc]init];
    NSMutableDictionary *  smallGoodsDic = [NSMutableDictionary dictionaryWithCapacity:1];
    
    [smallGoodsDic setObject:AgentID forKey:@"AgentID"];
    
    
    //[array addObject:smallGoodsDic];
    NSData *jsonData = [NSJSONSerialization dataWithJSONObject:smallGoodsDic options:NSJSONWritingPrettyPrinted error:nil];
    
    NSString *jsonString = [jsonData base64EncodedStringWithOptions:0];
    
    // EncryptionData *data  = [[EncryptionData alloc]init];
    NSString *str = [self encodeString:jsonString :@"hotkeycuk"];
    
    NSDictionary *paramer = @{@"sign":str};
    
    NSString *urls = [NSString stringWithFormat:@"http://api.dw521.com/api/profile/children.php?action=detail"];
    [manager POST:urls parameters:paramer success:^(AFHTTPRequestOperation *operation, id responseObject) {
        
        NSLog(@"登录信息responseObject=%@",responseObject);
        EncryptionData *encryption = [[EncryptionData alloc]init];
        NSString * str =[encryption decryption:[responseObject objectForKey:@"sign"] :@"hotkeycuk"];
        NSDictionary *dic = [str objectFromJSONString];
            [self.delegate childrenDetails:dic];
     
        
        
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        [self.delegate requistFail];
    }];
}

#pragma mark - 升级申请
-(void)gainUpgrade:(NSString *)AgentID{
    AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
    manager.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/html"];
    
    //NSMutableArray *array = [[NSMutableArray alloc]init];
    NSMutableDictionary *  smallGoodsDic = [NSMutableDictionary dictionaryWithCapacity:1];
    
    [smallGoodsDic setObject:AgentID forKey:@"AgentID"];
    
    
    //[array addObject:smallGoodsDic];
    NSData *jsonData = [NSJSONSerialization dataWithJSONObject:smallGoodsDic options:NSJSONWritingPrettyPrinted error:nil];
    
    NSString *jsonString = [jsonData base64EncodedStringWithOptions:0];
    
    // EncryptionData *data  = [[EncryptionData alloc]init];
    NSString *str = [self encodeString:jsonString :@"hotkeycuk"];
    
    NSDictionary *paramer = @{@"sign":str};
    
    NSString *urls = [NSString stringWithFormat:@"http://api.dw521.com/api/profile/upgrade.php"];
    [manager POST:urls parameters:paramer success:^(AFHTTPRequestOperation *operation, id responseObject) {
        
        NSLog(@"登录信息responseObject=%@",responseObject);
        EncryptionData *encryption = [[EncryptionData alloc]init];
        NSString * str =[encryption decryption:[responseObject objectForKey:@"sign"] :@"hotkeycuk"];
        NSDictionary *dic = [str objectFromJSONString];
            [self.delegate upgrade:dic];
     
        
        
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        [self.delegate requistFail];
    }];
}

#pragma mark - 获取省
-(void)gainProvince{
    AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
    manager.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/html"];
    
    
    NSString *urls = [NSString stringWithFormat:@"http://api.dw521.com/api/profile/config.php?action=getprovince"];
    [manager POST:urls parameters:nil success:^(AFHTTPRequestOperation *operation, id responseObject) {
        
        NSLog(@"登录信息responseObject=%@",responseObject);
        EncryptionData *encryption = [[EncryptionData alloc]init];
        NSString * str =[encryption decryption:[responseObject objectForKey:@"sign"] :@"hotkeycuk"];
        NSDictionary *dic = [str objectFromJSONString];
        [self.delegate province:dic];
        
        
        
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        [self.delegate requistFail];
    }];
    
}
#pragma mark - 获取市
-(void)gainCity:(NSString *)ProvinceID{
    AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
    manager.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/html"];
    
    //NSMutableArray *array = [[NSMutableArray alloc]init];
    NSMutableDictionary *  smallGoodsDic = [NSMutableDictionary dictionaryWithCapacity:1];
    
    [smallGoodsDic setObject:ProvinceID forKey:@"ProvinceID"];
    
    
    //[array addObject:smallGoodsDic];
    NSData *jsonData = [NSJSONSerialization dataWithJSONObject:smallGoodsDic options:NSJSONWritingPrettyPrinted error:nil];
    
    NSString *jsonString = [jsonData base64EncodedStringWithOptions:0];
    
    // EncryptionData *data  = [[EncryptionData alloc]init];
    NSString *str = [self encodeString:jsonString :@"hotkeycuk"];
    
    NSDictionary *paramer = @{@"sign":str};
    
    NSString *urls = [NSString stringWithFormat:@"http://api.dw521.com/api/profile/config.php?action=getcity"];
    [manager POST:urls parameters:paramer success:^(AFHTTPRequestOperation *operation, id responseObject) {
        
        NSLog(@"登录信息responseObject=%@",responseObject);
        EncryptionData *encryption = [[EncryptionData alloc]init];
        NSString * str =[encryption decryption:[responseObject objectForKey:@"sign"] :@"hotkeycuk"];
        NSDictionary *dic = [str objectFromJSONString];
            [self.delegate city:dic];
        
        
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        [self.delegate requistFail];
    }];
}

#pragma mark - 获取区
-(void)gainCountry:(NSString *)CityID{
    AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
    manager.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/html"];
    
    //NSMutableArray *array = [[NSMutableArray alloc]init];
    NSMutableDictionary *  smallGoodsDic = [NSMutableDictionary dictionaryWithCapacity:1];
    
    [smallGoodsDic setObject:CityID forKey:@"CityID"];
    
    
    //[array addObject:smallGoodsDic];
    NSData *jsonData = [NSJSONSerialization dataWithJSONObject:smallGoodsDic options:NSJSONWritingPrettyPrinted error:nil];
    
    NSString *jsonString = [jsonData base64EncodedStringWithOptions:0];
    
    // EncryptionData *data  = [[EncryptionData alloc]init];
    NSString *str = [self encodeString:jsonString :@"hotkeycuk"];
    
    NSDictionary *paramer = @{@"sign":str};
    
    NSString *urls = [NSString stringWithFormat:@"http://api.dw521.com/api/profile/config.php?action=getcounty"];
    [manager POST:urls parameters:paramer success:^(AFHTTPRequestOperation *operation, id responseObject) {
        
        NSLog(@"登录信息responseObject=%@",responseObject);
        EncryptionData *encryption = [[EncryptionData alloc]init];
        NSString * str =[encryption decryption:[responseObject objectForKey:@"sign"] :@"hotkeycuk"];
        NSDictionary *dic = [str objectFromJSONString];
            [self.delegate country:dic];
     
        
        
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        [self.delegate requistFail];
    }];
}

#pragma mark - 推荐新微商
-(void)gainRecommend:(NSString *)AgentID andRealName:(NSString *)RealName andMobileNumber:(NSString *)MobileNumber andLoginPass:(NSString *)LoginPass andProvinceID:(NSString *)ProvinceID andCityID:(NSString *)CityID andCountyID:(NSString *)CountyID andAddress:(NSString *)Address andLevelID:(NSString *)LevelID andWeChat:(NSString *)WeChat{
    AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
    manager.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/html"];
    
    //NSMutableArray *array = [[NSMutableArray alloc]init];
    NSMutableDictionary *  smallGoodsDic = [NSMutableDictionary dictionaryWithCapacity:1];
    
    [smallGoodsDic setObject:AgentID forKey:@"AgentID"];
    [smallGoodsDic setObject:RealName forKey:@"RealName"];
    [smallGoodsDic setObject:MobileNumber forKey:@"MobileNumber"];
    [smallGoodsDic setObject:LoginPass forKey:@"LoginPass"];
    [smallGoodsDic setObject:ProvinceID forKey:@"ProvinceID"];
    [smallGoodsDic setObject:CityID forKey:@"CityID"];
    [smallGoodsDic setObject:CountyID forKey:@"CountyID"];
    [smallGoodsDic setObject:Address forKey:@"Address"];
    [smallGoodsDic setObject:LevelID forKey:@"LevelID"];
    [smallGoodsDic setObject:WeChat forKey:@"WeChat"];

    
    
    
    
    //[array addObject:smallGoodsDic];
    NSData *jsonData = [NSJSONSerialization dataWithJSONObject:smallGoodsDic options:NSJSONWritingPrettyPrinted error:nil];
    
    NSString *jsonString = [jsonData base64EncodedStringWithOptions:0];
    
    // EncryptionData *data  = [[EncryptionData alloc]init];
    NSString *str = [self encodeString:jsonString :@"hotkeycuk"];
    
    NSDictionary *paramer = @{@"sign":str};
    
    NSString *urls = [NSString stringWithFormat:@"http://api.dw521.com/api/profile/recommend.php"];
    [manager POST:urls parameters:paramer success:^(AFHTTPRequestOperation *operation, id responseObject) {
        
        NSLog(@"登录信息responseObject=%@",responseObject);
        EncryptionData *encryption = [[EncryptionData alloc]init];
        NSString * str =[encryption decryption:[responseObject objectForKey:@"sign"] :@"hotkeycuk"];
        NSDictionary *dic = [str objectFromJSONString];
            [self.delegate recommend:dic];
       
        
        
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        [self.delegate requistFail];
    }];
    
}

#pragma mark - 获取商品列表
-(void)gainGoodsList:(NSString *)CategoryID andPageID:(NSString *)PageID andPerPage:(NSString *)PerPage andSearch:(NSString *)Search andAgentID:(NSString *)AgentID{
    AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
    manager.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/html"];
    
   //NSMutableArray *array = [[NSMutableArray alloc]init];
    NSMutableDictionary *  smallGoodsDic = [NSMutableDictionary dictionaryWithCapacity:1];
    
    [smallGoodsDic setObject:CategoryID forKey:@"CategoryID"];
    [smallGoodsDic setObject:AgentID forKey:@"AgentID"];
    [smallGoodsDic setObject:Search forKey:@"Search"];
    [smallGoodsDic setObject:PageID forKey:@"PageID"];
    [smallGoodsDic setObject:PerPage forKey:@"PerPage"];
   
    
    
    
    
    //[array addObject:smallGoodsDic];
    NSData *jsonData = [NSJSONSerialization dataWithJSONObject:smallGoodsDic options:NSJSONWritingPrettyPrinted error:nil];
    
    NSString *jsonString = [jsonData base64EncodedStringWithOptions:0];
    
    // EncryptionData *data  = [[EncryptionData alloc]init];
    NSString *str = [self encodeString:jsonString :@"hotkeycuk"];
    
    NSDictionary *paramer = @{@"sign":str};
    
    NSString *urls = [NSString stringWithFormat:@"http://api.dw521.com/api/product/goodslist.php"];
    [manager POST:urls parameters:paramer success:^(AFHTTPRequestOperation *operation, id responseObject) {
        
        NSLog(@"登录信息responseObject=%@",responseObject);
        EncryptionData *encryption = [[EncryptionData alloc]init];
        NSString * str =[encryption decryption:[responseObject objectForKey:@"sign"] :@"hotkeycuk"];
        NSDictionary *dic = [str objectFromJSONString];
            [self.delegate goodsList:dic];
        
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        [self.delegate requistFail];
    }];

}

#pragma mark - 获取图片素材
-(void)gainImage:(NSString *)ProductID andPageID:(NSString *)PageID andPerPage:(NSString *)PerPage{
    AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
    manager.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/html"];
    
    //NSMutableArray *array = [[NSMutableArray alloc]init];
    NSMutableDictionary *  smallGoodsDic = [NSMutableDictionary dictionaryWithCapacity:1];
    
    [smallGoodsDic setObject:ProductID forKey:@"ProductID"];
    [smallGoodsDic setObject:PageID forKey:@"PageID"];
    [smallGoodsDic setObject:PerPage forKey:@"PerPage"];

    //[array addObject:smallGoodsDic];
    NSData *jsonData = [NSJSONSerialization dataWithJSONObject:smallGoodsDic options:NSJSONWritingPrettyPrinted error:nil];
    
    NSString *jsonString = [jsonData base64EncodedStringWithOptions:0];
    
    // EncryptionData *data  = [[EncryptionData alloc]init];
    NSString *str = [self encodeString:jsonString :@"hotkeycuk"];
    
    NSDictionary *paramer = @{@"sign":str};
    
    NSString *urls = [NSString stringWithFormat:@"http://api.dw521.com/api/profile/images.php"];
    [manager POST:urls parameters:paramer success:^(AFHTTPRequestOperation *operation, id responseObject) {
        
        NSLog(@"登录信息responseObject=%@",responseObject);
        EncryptionData *encryption = [[EncryptionData alloc]init];
        NSString * str =[encryption decryption:[responseObject objectForKey:@"sign"] :@"hotkeycuk"];
        NSDictionary *dic = [str objectFromJSONString];
            [self.delegate images:dic];
       
        
        
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        [self.delegate requistFail];
    }];
}

#pragma mark - 发起升级申请
-(void)sendApply:(NSString *)AgentID{
    AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
    manager.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/html"];
    
    //NSMutableArray *array = [[NSMutableArray alloc]init];
    NSMutableDictionary *  smallGoodsDic = [NSMutableDictionary dictionaryWithCapacity:1];
    
    [smallGoodsDic setObject:AgentID forKey:@"AgentID"];

    
    //[array addObject:smallGoodsDic];
    NSData *jsonData = [NSJSONSerialization dataWithJSONObject:smallGoodsDic options:NSJSONWritingPrettyPrinted error:nil];
    
    NSString *jsonString = [jsonData base64EncodedStringWithOptions:0];
    
    // EncryptionData *data  = [[EncryptionData alloc]init];
    NSString *str = [self encodeString:jsonString :@"hotkeycuk"];
    
    NSDictionary *paramer = @{@"sign":str};
    
    NSString *urls = [NSString stringWithFormat:@"http://api.dw521.com/api/profile/upgrade.php?action=apply"];
    [manager POST:urls parameters:paramer success:^(AFHTTPRequestOperation *operation, id responseObject) {
        
        NSLog(@"登录信息responseObject=%@",responseObject);
        EncryptionData *encryption = [[EncryptionData alloc]init];
        NSString * str =[encryption decryption:[responseObject objectForKey:@"sign"] :@"hotkeycuk"];
        NSDictionary *dic = [str objectFromJSONString];
            [self.delegate apply:dic];
      
        
        
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        [self.delegate requistFail];
    }];
}
#pragma mark - 审核升级申请
-(void)sendVerify:(NSString *)AgentID andChildAgentID:(NSString *)ChildAgentID andVerifyResult:(NSString *)VerifyResult andVerifyReason:(NSString *)VerifyReason{
    AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
    manager.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/html"];
    
    //NSMutableArray *array = [[NSMutableArray alloc]init];
    NSMutableDictionary *  smallGoodsDic = [NSMutableDictionary dictionaryWithCapacity:1];
    
    [smallGoodsDic setObject:AgentID forKey:@"AgentID"];
    [smallGoodsDic setObject:ChildAgentID forKey:@"ChildAgentID"];
    [smallGoodsDic setObject:VerifyResult forKey:@"VerifyResult"];
    [smallGoodsDic setObject:VerifyReason forKey:@"VerifyReason"];

    //[array addObject:smallGoodsDic];
    NSData *jsonData = [NSJSONSerialization dataWithJSONObject:smallGoodsDic options:NSJSONWritingPrettyPrinted error:nil];
    
    NSString *jsonString = [jsonData base64EncodedStringWithOptions:0];
    
    // EncryptionData *data  = [[EncryptionData alloc]init];
    NSString *str = [self encodeString:jsonString :@"hotkeycuk"];
    
    NSDictionary *paramer = @{@"sign":str};
    
    NSString *urls = [NSString stringWithFormat:@"http://api.dw521.com/api/profile/upgrade.php?action=verify"];
    [manager POST:urls parameters:paramer success:^(AFHTTPRequestOperation *operation, id responseObject) {
        
        NSLog(@"登录信息responseObject=%@",responseObject);
        EncryptionData *encryption = [[EncryptionData alloc]init];
        NSString * str =[encryption decryption:[responseObject objectForKey:@"sign"] :@"hotkeycuk"];
        NSDictionary *dic = [str objectFromJSONString];
        [self.delegate verify:dic];
      
        
        
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        [self.delegate requistFail];
    }];

}
#pragma mark - 直接升级
-(void)upgradeNow:(NSString *)AgentID andChildAgentID:(NSString *)ChildAgentID{
    AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
    manager.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/html"];
    
    //NSMutableArray *array = [[NSMutableArray alloc]init];
    NSMutableDictionary *  smallGoodsDic = [NSMutableDictionary dictionaryWithCapacity:1];
    
    [smallGoodsDic setObject:AgentID forKey:@"AgentID"];
    [smallGoodsDic setObject:ChildAgentID forKey:@"ChildAgentID"];
    
    //[array addObject:smallGoodsDic];
    NSData *jsonData = [NSJSONSerialization dataWithJSONObject:smallGoodsDic options:NSJSONWritingPrettyPrinted error:nil];
    
    NSString *jsonString = [jsonData base64EncodedStringWithOptions:0];
    
    // EncryptionData *data  = [[EncryptionData alloc]init];
    NSString *str = [self encodeString:jsonString :@"hotkeycuk"];
    
    NSDictionary *paramer = @{@"sign":str};
    
    NSString *urls = [NSString stringWithFormat:@"http://api.dw521.com/api/profile/upgrade.php?action=upgrade"];
    [manager POST:urls parameters:paramer success:^(AFHTTPRequestOperation *operation, id responseObject) {
        
        NSLog(@"登录信息responseObject=%@",responseObject);
        EncryptionData *encryption = [[EncryptionData alloc]init];
        NSString * str =[encryption decryption:[responseObject objectForKey:@"sign"] :@"hotkeycuk"];
        NSDictionary *dic = [str objectFromJSONString];
        [self.delegate upgradeNow:dic];
       
        
        
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        [self.delegate requistFail];
    }];
}
#pragma mark - 获取推广素材详细信息
-(void)gainPromotionDetails:(NSString *)ArticleID{
    AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
    manager.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/html"];
    
    //NSMutableArray *array = [[NSMutableArray alloc]init];
    NSMutableDictionary *  smallGoodsDic = [NSMutableDictionary dictionaryWithCapacity:1];
    
    [smallGoodsDic setObject:ArticleID forKey:@"ArticleID"];
    
    
    //[array addObject:smallGoodsDic];
    NSData *jsonData = [NSJSONSerialization dataWithJSONObject:smallGoodsDic options:NSJSONWritingPrettyPrinted error:nil];
    
    NSString *jsonString = [jsonData base64EncodedStringWithOptions:0];
    
    // EncryptionData *data  = [[EncryptionData alloc]init];
    NSString *str = [self encodeString:jsonString :@"hotkeycuk"];
    
    NSDictionary *paramer = @{@"sign":str};
    
    NSString *urls = [NSString stringWithFormat:@"http://api.dw521.com/api/profile/promotion.php?action=detail"];
    [manager POST:urls parameters:paramer success:^(AFHTTPRequestOperation *operation, id responseObject) {
        
        NSLog(@"登录信息responseObject=%@",responseObject);
        EncryptionData *encryption = [[EncryptionData alloc]init];
        NSString * str =[encryption decryption:[responseObject objectForKey:@"sign"] :@"hotkeycuk"];
        NSDictionary *dic = [str objectFromJSONString];
            [self.delegate promotionDetail:dic];
      
        
        
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        [self.delegate requistFail];
    }];
}

#pragma mark - 获取授权书
-(void)gainAuthority:(NSString *)AgentID{
    AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
    manager.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/html"];
    
    //NSMutableArray *array = [[NSMutableArray alloc]init];
    NSMutableDictionary *  smallGoodsDic = [NSMutableDictionary dictionaryWithCapacity:1];
    
    [smallGoodsDic setObject:AgentID forKey:@"AgentID"];
    
    
    //[array addObject:smallGoodsDic];
    NSData *jsonData = [NSJSONSerialization dataWithJSONObject:smallGoodsDic options:NSJSONWritingPrettyPrinted error:nil];
    
    NSString *jsonString = [jsonData base64EncodedStringWithOptions:0];
    
    // EncryptionData *data  = [[EncryptionData alloc]init];
    NSString *str = [self encodeString:jsonString :@"hotkeycuk"];
    
    NSDictionary *paramer = @{@"sign":str};
    
    NSString *urls = [NSString stringWithFormat:@"http://api.dw521.com/api/profile/config.php?action=authority"];
    [manager POST:urls parameters:paramer success:^(AFHTTPRequestOperation *operation, id responseObject) {
        if (responseObject == nil) {
            [self.delegate requistError];
            return ;
            
        }
        NSLog(@"登录信息responseObject=%@",responseObject);
        EncryptionData *encryption = [[EncryptionData alloc]init];
        NSString * str =[encryption decryption:[responseObject objectForKey:@"sign"] :@"hotkeycuk"];
        NSDictionary *dic = [str objectFromJSONString];
            [self.delegate authority:dic];
      
        
        
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        [self.delegate requistFail];
    }];}
#pragma mark - 获取等级制度
-(void)gainGrade{
    AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
    manager.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/html"];
    
    
    NSString *urls = [NSString stringWithFormat:@"http://api.dw521.com/api/profile/config.php?action=grade"];
    [manager POST:urls parameters:nil success:^(AFHTTPRequestOperation *operation, id responseObject) {
        
        NSLog(@"登录信息responseObject=%@",responseObject);
        EncryptionData *encryption = [[EncryptionData alloc]init];
        NSString * str =[encryption decryption:[responseObject objectForKey:@"sign"] :@"hotkeycuk"];
        NSDictionary *dic = [str objectFromJSONString];
            [self.delegate grade:dic];
       
        
        
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        [self.delegate requistFail];
    }];
    
}

#pragma mark - 获取商品价格列表
-(void)gainPrice:(NSString *)AgentID{
    AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
    manager.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/html"];
    
    //NSMutableArray *array = [[NSMutableArray alloc]init];
    NSMutableDictionary *  smallGoodsDic = [NSMutableDictionary dictionaryWithCapacity:1];
    
    [smallGoodsDic setObject:AgentID forKey:@"AgentID"];
    
    
    //[array addObject:smallGoodsDic];
    NSData *jsonData = [NSJSONSerialization dataWithJSONObject:smallGoodsDic options:NSJSONWritingPrettyPrinted error:nil];
    
    NSString *jsonString = [jsonData base64EncodedStringWithOptions:0];
    
    // EncryptionData *data  = [[EncryptionData alloc]init];
    NSString *str = [self encodeString:jsonString :@"hotkeycuk"];
    
    NSDictionary *paramer = @{@"sign":str};
    
    NSString *urls = [NSString stringWithFormat:@"http://api.dw521.com/api/product/goodslist.php?action=price"];
    [manager POST:urls parameters:paramer success:^(AFHTTPRequestOperation *operation, id responseObject) {
        
        NSLog(@"登录信息responseObject=%@",responseObject);
        EncryptionData *encryption = [[EncryptionData alloc]init];
        NSString * str =[encryption decryption:[responseObject objectForKey:@"sign"] :@"hotkeycuk"];
        NSDictionary *dic = [str objectFromJSONString];
            [self.delegate price:dic];
      
        
        
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        [self.delegate requistFail];
    }];
}
#pragma mark - 获取二维码
-(void)gainQrcode:(NSString *)AgentID andLevelID:(NSString *)LevelID{
    AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
    manager.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/html"];
    
    //NSMutableArray *array = [[NSMutableArray alloc]init];
    NSMutableDictionary *  smallGoodsDic = [NSMutableDictionary dictionaryWithCapacity:1];
    
    [smallGoodsDic setObject:AgentID forKey:@"AgentID"];
    [smallGoodsDic setObject:LevelID forKey:@"LevelID"];

    
    //[array addObject:smallGoodsDic];
    NSData *jsonData = [NSJSONSerialization dataWithJSONObject:smallGoodsDic options:NSJSONWritingPrettyPrinted error:nil];
    
    NSString *jsonString = [jsonData base64EncodedStringWithOptions:0];
    
    // EncryptionData *data  = [[EncryptionData alloc]init];
    NSString *str = [self encodeString:jsonString :@"hotkeycuk"];
    
    NSDictionary *paramer = @{@"sign":str};
    
    NSString *urls = [NSString stringWithFormat:@"http://api.dw521.com/api/profile/getqrcode.php"];
    [manager POST:urls parameters:paramer success:^(AFHTTPRequestOperation *operation, id responseObject) {
        
        NSLog(@"登录信息responseObject=%@",responseObject);
        EncryptionData *encryption = [[EncryptionData alloc]init];
        NSString * str =[encryption decryption:[responseObject objectForKey:@"sign"] :@"hotkeycuk"];
        NSDictionary *dic = [str objectFromJSONString];
            [self.delegate qrcode:dic];
       
        
        
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        [self.delegate requistFail];
    }];
}

#pragma mark - 获取银行省
-(void)gainBackProvince{
    AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
    manager.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/html"];
    
    
    NSString *urls = [NSString stringWithFormat:@"http://api.dw521.com/api/profile/config.php?action=getbankprovince"];
    [manager POST:urls parameters:nil success:^(AFHTTPRequestOperation *operation, id responseObject) {
        
        NSLog(@"登录信息responseObject=%@",responseObject);
        EncryptionData *encryption = [[EncryptionData alloc]init];
        NSString * str =[encryption decryption:[responseObject objectForKey:@"sign"] :@"hotkeycuk"];
        NSDictionary *dic = [str objectFromJSONString];
            [self.delegate bankProvince:dic];
        
        
        
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        [self.delegate requistFail];
    }];
}
#pragma mark - 获取银行市
-(void)gainBackCity:(NSString *)ProvinceID{
    AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
    manager.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/html"];
    
    //NSMutableArray *array = [[NSMutableArray alloc]init];
    NSMutableDictionary *  smallGoodsDic = [NSMutableDictionary dictionaryWithCapacity:1];
    
    [smallGoodsDic setObject:ProvinceID forKey:@"ProvinceID"];
    
    
    //[array addObject:smallGoodsDic];
    NSData *jsonData = [NSJSONSerialization dataWithJSONObject:smallGoodsDic options:NSJSONWritingPrettyPrinted error:nil];
    
    NSString *jsonString = [jsonData base64EncodedStringWithOptions:0];
    
    // EncryptionData *data  = [[EncryptionData alloc]init];
    NSString *str = [self encodeString:jsonString :@"hotkeycuk"];
    
    NSDictionary *paramer = @{@"sign":str};
    
    NSString *urls = [NSString stringWithFormat:@"http://api.dw521.com/api/profile/config.php?action=getbankcity"];
    [manager POST:urls parameters:paramer success:^(AFHTTPRequestOperation *operation, id responseObject) {
        
        NSLog(@"登录信息responseObject=%@",responseObject);
        EncryptionData *encryption = [[EncryptionData alloc]init];
        NSString * str =[encryption decryption:[responseObject objectForKey:@"sign"] :@"hotkeycuk"];
        NSDictionary *dic = [str objectFromJSONString];
            [self.delegate bankCity:dic];
       
        
        
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        [self.delegate requistFail];
    }];

}
#pragma mark - 获取银行列表接口
-(void)gainBankList:(NSString *)IsBoss{
    AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
    manager.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/html"];
    
    //NSMutableArray *array = [[NSMutableArray alloc]init];
    NSMutableDictionary *  smallGoodsDic = [NSMutableDictionary dictionaryWithCapacity:1];
    
    [smallGoodsDic setObject:IsBoss forKey:@"IsBoss"];
    
    
    //[array addObject:smallGoodsDic];
    NSData *jsonData = [NSJSONSerialization dataWithJSONObject:smallGoodsDic options:NSJSONWritingPrettyPrinted error:nil];
    
    NSString *jsonString = [jsonData base64EncodedStringWithOptions:0];
    
    // EncryptionData *data  = [[EncryptionData alloc]init];
    NSString *str = [self encodeString:jsonString :@"hotkeycuk"];
    
    NSDictionary *paramer = @{@"sign":str};
    
    NSString *urls = [NSString stringWithFormat:@"http://api.dw521.com/api/profile/config.php?action=getbanklist"];
    [manager POST:urls parameters:paramer success:^(AFHTTPRequestOperation *operation, id responseObject) {
        
        NSLog(@"登录信息responseObject=%@",responseObject);
        EncryptionData *encryption = [[EncryptionData alloc]init];
        NSString * str =[encryption decryption:[responseObject objectForKey:@"sign"] :@"hotkeycuk"];
        NSDictionary *dic = [str objectFromJSONString];
            [self.delegate bankList:dic];
       
        
        
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        [self.delegate requistFail];
        [[NSNotificationCenter defaultCenter]postNotificationName:@"errorBind" object:nil];
    }];
}
#pragma mark - 绑定银行卡
-(void)binding:(NSString *)AgentID andBankID:(NSString *)BankID andBankBranch:(NSString *)BankBranch  andCardNumber:(NSString *)CardNumber andProvinceID:(NSString *)ProvinceID andCityID:(NSString *)CityID merOrderId:(NSString *)merOrderId phoneNo:(NSString *)phoneNo phoneToken:(NSString *)phoneToken mobileNumber:(NSString *)phoneNum code:(NSString *)code{
    AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
    manager.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/html"];
    NSMutableDictionary *  smallGoodsDic = [NSMutableDictionary dictionaryWithCapacity:1];
    [smallGoodsDic setObject:AgentID forKey:@"AgentID"];
    [smallGoodsDic setObject:BankID forKey:@"BankID"];
//    [smallGoodsDic setObject:BankBranch forKey:@"BankBranch"];
    [smallGoodsDic setObject:merOrderId forKey:@"merOrderId"];
    [smallGoodsDic setObject:phoneNo forKey:@"phoneNo"];
    [smallGoodsDic setObject:phoneToken forKey:@"phoneToken"];
    [smallGoodsDic setObject:CardNumber forKey:@"CardNumber"];
    [smallGoodsDic setObject:ProvinceID forKey:@"ProvinceID"];
    [smallGoodsDic setObject:CityID forKey:@"CityID"];
    [smallGoodsDic setObject:phoneNum forKey:@"MobileNumber"];
    [smallGoodsDic setObject:code forKey:@"Code"];
    NSData *jsonData = [NSJSONSerialization dataWithJSONObject:smallGoodsDic options:NSJSONWritingPrettyPrinted error:nil];
    NSString *jsonString = [jsonData base64EncodedStringWithOptions:0];
    NSString *str = [self encodeString:jsonString :@"hotkeycuk"];
    NSDictionary *paramer = @{@"sign":str};
    NSString *urls = [NSString stringWithFormat:@"http://api.dw521.com/api/profile/bind.php"];
    [manager POST:urls parameters:paramer success:^(AFHTTPRequestOperation *operation, id responseObject) {
        NSLog(@"登录信息responseObject=%@",responseObject);
        EncryptionData *encryption = [[EncryptionData alloc]init];
        NSString * str =[encryption decryption:[responseObject objectForKey:@"sign"] :@"hotkeycuk"];
        NSDictionary *dic = [str objectFromJSONString];
            [self.delegate bind:dic];
      
        
        
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        [self.delegate requistFail];
    }];
}

#pragma mark - 检查银行卡
-(void)checkBank:(NSString *)AgentID{
    AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
    manager.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/html"];
    
    //NSMutableArray *array = [[NSMutableArray alloc]init];
    NSMutableDictionary *  smallGoodsDic = [NSMutableDictionary dictionaryWithCapacity:1];
    
    [smallGoodsDic setObject:AgentID forKey:@"AgentID"];
    
    
    //[array addObject:smallGoodsDic];
    NSData *jsonData = [NSJSONSerialization dataWithJSONObject:smallGoodsDic options:NSJSONWritingPrettyPrinted error:nil];
    
    NSString *jsonString = [jsonData base64EncodedStringWithOptions:0];
    
    // EncryptionData *data  = [[EncryptionData alloc]init];
    NSString *str = [self encodeString:jsonString :@"hotkeycuk"];
    
    NSDictionary *paramer = @{@"sign":str};
    
    NSString *urls = [NSString stringWithFormat:@"http://api.dw521.com/api/profile/bind.php?action=check"];
    [manager POST:urls parameters:paramer success:^(AFHTTPRequestOperation *operation, id responseObject) {
        
        NSLog(@"登录信息responseObject=%@",responseObject);
        EncryptionData *encryption = [[EncryptionData alloc]init];
        NSString * str =[encryption decryption:[responseObject objectForKey:@"sign"] :@"hotkeycuk"];
        NSDictionary *dic = [str objectFromJSONString];
            [self.delegate checkBank:dic];

        
        
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        NSLog(@"error");
        [self.delegate requistFail];
        
    }];
}

#pragma mark - 提现说明
-(void)tiXian{
    AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
    manager.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/html"];
    
    
    NSString *urls = [NSString stringWithFormat:@"http://api.dw521.com/api/profile/config.php?action=withdraw"];
    [manager POST:urls parameters:nil success:^(AFHTTPRequestOperation *operation, id responseObject) {
        
        NSLog(@"登录信息responseObject=%@",responseObject);
        EncryptionData *encryption = [[EncryptionData alloc]init];
        NSString * str =[encryption decryption:[responseObject objectForKey:@"sign"] :@"hotkeycuk"];
        NSDictionary *dic = [str objectFromJSONString];
            [self.delegate tiXian:dic];
        
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        [self.delegate requistFail];
    }];

}
#pragma mark - 自动补货说明
-(void)ziDongBuHuo{
    AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
    manager.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/html"];
    
    
    NSString *urls = [NSString stringWithFormat:@"http://api.dw521.com/api/profile/config.php?action=makeup"];
    [manager POST:urls parameters:nil success:^(AFHTTPRequestOperation *operation, id responseObject) {
        
        NSLog(@"登录信息responseObject=%@",responseObject);
        EncryptionData *encryption = [[EncryptionData alloc]init];
        NSString * str =[encryption decryption:[responseObject objectForKey:@"sign"] :@"hotkeycuk"];
        NSDictionary *dic = [str objectFromJSONString];
            [self.delegate ziDongBuHuo:dic];
        
        
        
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        [self.delegate requistFail];
    }];
}

#pragma mark - 获取实名认证
-(void)getID5:(NSString *)AgentID{
    AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
    manager.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/html"];
    
    //NSMutableArray *array = [[NSMutableArray alloc]init];
    NSMutableDictionary *  smallGoodsDic = [NSMutableDictionary dictionaryWithCapacity:1];
    
    [smallGoodsDic setObject:AgentID forKey:@"AgentID"];
    
    
    //[array addObject:smallGoodsDic];
    NSData *jsonData = [NSJSONSerialization dataWithJSONObject:smallGoodsDic options:NSJSONWritingPrettyPrinted error:nil];
    
    NSString *jsonString = [jsonData base64EncodedStringWithOptions:0];
    
    // EncryptionData *data  = [[EncryptionData alloc]init];
    NSString *str = [self encodeString:jsonString :@"hotkeycuk"];
    
    NSDictionary *paramer = @{@"sign":str};
    
    NSString *urls = [NSString stringWithFormat:@"http://api.dw521.com/api/profile/security.php?action=getid5"];
    [manager POST:urls parameters:paramer success:^(AFHTTPRequestOperation *operation, id responseObject) {
        
        NSLog(@"登录信息responseObject=%@",responseObject);
        EncryptionData *encryption = [[EncryptionData alloc]init];
        NSString * str =[encryption decryption:[responseObject objectForKey:@"sign"] :@"hotkeycuk"];
        NSDictionary *dic = [str objectFromJSONString];
        [self.delegate getID5:dic];
      
        
        
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        [self.delegate requistFail];
    }];
}

#pragma mark - 实名认证，设置交易密码
-(void)shiAll:(NSString *)AgentID andRealName:(NSString *)RealName andCertificateNumber:(NSString *)CertificateNumber andTradePass:(NSString *)TradePass andReTradePass:(NSString *)ReTradePass{
    AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
    manager.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/html"];
    
    //NSMutableArray *array = [[NSMutableArray alloc]init];
    NSMutableDictionary *  smallGoodsDic = [NSMutableDictionary dictionaryWithCapacity:1];
    
    [smallGoodsDic setObject:AgentID forKey:@"AgentID"];
    [smallGoodsDic setObject:RealName forKey:@"RealName"];
    [smallGoodsDic setObject:CertificateNumber forKey:@"CertificateNumber"];
    [smallGoodsDic setObject:TradePass forKey:@"TradePass"];
    [smallGoodsDic setObject:ReTradePass forKey:@"ReTradePass"];

    
    //[array addObject:smallGoodsDic];
    NSData *jsonData = [NSJSONSerialization dataWithJSONObject:smallGoodsDic options:NSJSONWritingPrettyPrinted error:nil];
    
    NSString *jsonString = [jsonData base64EncodedStringWithOptions:0];
    
    // EncryptionData *data  = [[EncryptionData alloc]init];
    NSString *str = [self encodeString:jsonString :@"hotkeycuk"];
    
    NSDictionary *paramer = @{@"sign":str};
    
    NSString *urls = [NSString stringWithFormat:@"http://api.dw521.com/api/profile/security.php?action=all"];
    [manager POST:urls parameters:paramer success:^(AFHTTPRequestOperation *operation, id responseObject) {
        
        NSLog(@"登录信息responseObject=%@",responseObject);
        EncryptionData *encryption = [[EncryptionData alloc]init];
        NSString * str =[encryption decryption:[responseObject objectForKey:@"sign"] :@"hotkeycuk"];
        NSDictionary *dic = [str objectFromJSONString];
                [self.delegate shiAll:dic];
       
        
        
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        [self.delegate requistFail];
    }];

}
#pragma mark - 判断交易密码是否正确
-(void)checkTrade:(NSString *)AgentID andTradePass:(NSString *)TradePass{
    AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
    manager.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/html"];
    
    //NSMutableArray *array = [[NSMutableArray alloc]init];
    NSMutableDictionary *  smallGoodsDic = [NSMutableDictionary dictionaryWithCapacity:1];
    
    [smallGoodsDic setObject:AgentID forKey:@"AgentID"];
    [smallGoodsDic setObject:TradePass forKey:@"TradePass"];

    //[array addObject:smallGoodsDic];
    NSData *jsonData = [NSJSONSerialization dataWithJSONObject:smallGoodsDic options:NSJSONWritingPrettyPrinted error:nil];
    
    NSString *jsonString = [jsonData base64EncodedStringWithOptions:0];
    
    // EncryptionData *data  = [[EncryptionData alloc]init];
    NSString *str = [self encodeString:jsonString :@"hotkeycuk"];
    
    NSDictionary *paramer = @{@"sign":str};
    
    NSString *urls = [NSString stringWithFormat:@"http://api.dw521.com/api/profile/security.php?action=checktrade"];
    [manager POST:urls parameters:paramer success:^(AFHTTPRequestOperation *operation, id responseObject) {
        
        NSLog(@"登录信息responseObject=%@",responseObject);
        EncryptionData *encryption = [[EncryptionData alloc]init];
        NSString * str =[encryption decryption:[responseObject objectForKey:@"sign"] :@"hotkeycuk"];
        NSDictionary *dic = [str objectFromJSONString];
            [self.delegate checktrade:dic];
      
        
        
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        [self.delegate requistFail];
    }];
    

}

#pragma mark - 修改交易密码
-(void)modifyTrade:(NSString *)AgentID andOldTradePass:(NSString *)OldTradePass andNewTradePass:(NSString *)NewTradePass andReNewTradePass:(NSString *)ReNewTradePass{
    AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
    manager.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/html"];
    
    //NSMutableArray *array = [[NSMutableArray alloc]init];
    NSMutableDictionary *  smallGoodsDic = [NSMutableDictionary dictionaryWithCapacity:1];
    
    [smallGoodsDic setObject:AgentID forKey:@"AgentID"];
    [smallGoodsDic setObject:OldTradePass forKey:@"OldTradePass"];
    [smallGoodsDic setObject:NewTradePass forKey:@"NewTradePass"];
    [smallGoodsDic setObject:ReNewTradePass forKey:@"ReNewTradePass"];

    //[array addObject:smallGoodsDic];
    NSData *jsonData = [NSJSONSerialization dataWithJSONObject:smallGoodsDic options:NSJSONWritingPrettyPrinted error:nil];
    
    NSString *jsonString = [jsonData base64EncodedStringWithOptions:0];
    
    // EncryptionData *data  = [[EncryptionData alloc]init];
    NSString *str = [self encodeString:jsonString :@"hotkeycuk"];
    
    NSDictionary *paramer = @{@"sign":str};
    
    NSString *urls = [NSString stringWithFormat:@"http://api.dw521.com/api/profile/security.php?action=modifytrade"];
    [manager POST:urls parameters:paramer success:^(AFHTTPRequestOperation *operation, id responseObject) {
        
        NSLog(@"登录信息responseObject=%@",responseObject);
        EncryptionData *encryption = [[EncryptionData alloc]init];
        NSString * str =[encryption decryption:[responseObject objectForKey:@"sign"] :@"hotkeycuk"];
        NSDictionary *dic = [str objectFromJSONString];
            [self.delegate modifytrade:dic];
       
        
        
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        [self.delegate requistFail];
    }];
    
}

#pragma mark - 结算物流费用
-(void)payOff:(NSString *)AgentID andTradePass:(NSString *)TradePass andIsUserBalance:(NSString *)IsUseBalance{
    AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
    manager.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/html"];
    
    //NSMutableArray *array = [[NSMutableArray alloc]init];
    NSMutableDictionary *  smallGoodsDic = [NSMutableDictionary dictionaryWithCapacity:1];
    
    [smallGoodsDic setObject:AgentID forKey:@"AgentID"];
    [smallGoodsDic setObject:TradePass forKey:@"TradePass"];
    [smallGoodsDic setObject:IsUseBalance forKey:@"IsUseBalance"];
    
    //[array addObject:smallGoodsDic];
    NSData *jsonData = [NSJSONSerialization dataWithJSONObject:smallGoodsDic options:NSJSONWritingPrettyPrinted error:nil];
    
    NSString *jsonString = [jsonData base64EncodedStringWithOptions:0];
    
    // EncryptionData *data  = [[EncryptionData alloc]init];
    NSString *str = [self encodeString:jsonString :@"hotkeycuk"];
    
    NSDictionary *paramer = @{@"sign":str};
    
    NSString *urls = [NSString stringWithFormat:@"http://api.dw521.com/api/order/express.php?action=payoff"];
    [manager POST:urls parameters:paramer success:^(AFHTTPRequestOperation *operation, id responseObject) {
        
        NSLog(@"登录信息responseObject=%@",responseObject);
        EncryptionData *encryption = [[EncryptionData alloc]init];
        NSString * str =[encryption decryption:[responseObject objectForKey:@"sign"] :@"hotkeycuk"];
        NSDictionary *dic = [str objectFromJSONString];
            [self.delegate payOff:dic];
       
        
        
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        [self.delegate requistFail];
    }];
}
#pragma mark - 用户协议
-(void)userProtocol{
    AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
    manager.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/html"];
    
    
    NSString *urls = [NSString stringWithFormat:@"http://api.dw521.com/api/profile/config.php?action=agreement"];
    [manager POST:urls parameters:nil success:^(AFHTTPRequestOperation *operation, id responseObject) {
        
        NSLog(@"登录信息responseObject=%@",responseObject);
        EncryptionData *encryption = [[EncryptionData alloc]init];
        NSString * str =[encryption decryption:[responseObject objectForKey:@"sign"] :@"hotkeycuk"];
        NSDictionary *dic = [str objectFromJSONString];
        [self.delegate userProtocol:dic];
        
        
        
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        [self.delegate requistFail];
    }];
}
#pragma mark - 结算保证金
-(void)baoZhengJinJie:(NSString *)AgentID andTradePass:(NSString *)TradePass{
    AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
    manager.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/html"];
    
    //NSMutableArray *array = [[NSMutableArray alloc]init];
    NSMutableDictionary *  smallGoodsDic = [NSMutableDictionary dictionaryWithCapacity:1];
    
    [smallGoodsDic setObject:AgentID forKey:@"AgentID"];
    [smallGoodsDic setObject:TradePass forKey:@"TradePass"];
    
    //[array addObject:smallGoodsDic];
    NSData *jsonData = [NSJSONSerialization dataWithJSONObject:smallGoodsDic options:NSJSONWritingPrettyPrinted error:nil];
    
    NSString *jsonString = [jsonData base64EncodedStringWithOptions:0];
    
    // EncryptionData *data  = [[EncryptionData alloc]init];
    NSString *str = [self encodeString:jsonString :@"hotkeycuk"];
    
    NSDictionary *paramer = @{@"sign":str};
    
    NSString *urls = [NSString stringWithFormat:@"http://api.dw521.com/api/profile/deposit.php?action=payoff"];
    [manager POST:urls parameters:paramer success:^(AFHTTPRequestOperation *operation, id responseObject) {
        
        NSLog(@"登录信息responseObject=%@",responseObject);
        EncryptionData *encryption = [[EncryptionData alloc]init];
        NSString * str =[encryption decryption:[responseObject objectForKey:@"sign"] :@"hotkeycuk"];
        NSDictionary *dic = [str objectFromJSONString];
        [self.delegate baoZhengPay:dic];
        
        
        
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        [self.delegate requistFail];
    }];

}
#pragma mark - 结算全部物流费用
-(void)wuLiuFeiJie:(NSString *)AgentID andTradePass:(NSString *)TradePass{
    AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
    manager.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/html"];
    
    //NSMutableArray *array = [[NSMutableArray alloc]init];
    NSMutableDictionary *  smallGoodsDic = [NSMutableDictionary dictionaryWithCapacity:1];
    
    [smallGoodsDic setObject:AgentID forKey:@"AgentID"];
    [smallGoodsDic setObject:TradePass forKey:@"TradePass"];
    
    //[array addObject:smallGoodsDic];
    NSData *jsonData = [NSJSONSerialization dataWithJSONObject:smallGoodsDic options:NSJSONWritingPrettyPrinted error:nil];
    
    NSString *jsonString = [jsonData base64EncodedStringWithOptions:0];
    
    // EncryptionData *data  = [[EncryptionData alloc]init];
    NSString *str = [self encodeString:jsonString :@"hotkeycuk"];
    
    NSDictionary *paramer = @{@"sign":str};
    
    NSString *urls = [NSString stringWithFormat:@"http://api.dw521.com/api/order/express.php?action=payoff"];
    [manager POST:urls parameters:paramer success:^(AFHTTPRequestOperation *operation, id responseObject) {
        
        NSLog(@"登录信息responseObject=%@",responseObject);
        EncryptionData *encryption = [[EncryptionData alloc]init];
        NSString * str =[encryption decryption:[responseObject objectForKey:@"sign"] :@"hotkeycuk"];
        NSDictionary *dic = [str objectFromJSONString];
        [self.delegate WuLiuPay:dic];
        
        
        
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        [self.delegate requistFail];
    }];
}
#pragma mark - 物流费账单列表
-(void)wuLiuFeiZhangDan:(NSString *)AgentID{
    AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
    manager.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/html"];
    
    //NSMutableArray *array = [[NSMutableArray alloc]init];
    NSMutableDictionary *  smallGoodsDic = [NSMutableDictionary dictionaryWithCapacity:1];
    
    [smallGoodsDic setObject:AgentID forKey:@"AgentID"];
    
    //[array addObject:smallGoodsDic];
    NSData *jsonData = [NSJSONSerialization dataWithJSONObject:smallGoodsDic options:NSJSONWritingPrettyPrinted error:nil];
    
    NSString *jsonString = [jsonData base64EncodedStringWithOptions:0];
    
    // EncryptionData *data  = [[EncryptionData alloc]init];
    NSString *str = [self encodeString:jsonString :@"hotkeycuk"];
    
    NSDictionary *paramer = @{@"sign":str};
    
    NSString *urls = [NSString stringWithFormat:@"http://api.dw521.com/api/order/express.php?action=getlist"];
    [manager POST:urls parameters:paramer success:^(AFHTTPRequestOperation *operation, id responseObject) {
        
        NSLog(@"登录信息responseObject=%@",responseObject);
        EncryptionData *encryption = [[EncryptionData alloc]init];
        NSString * str =[encryption decryption:[responseObject objectForKey:@"sign"] :@"hotkeycuk"];
        NSDictionary *dic = [str objectFromJSONString];
        [self.delegate WuLiuZhangDan:dic];
        
        
        
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        [self.delegate requistFail];
    }];

}

#pragma mark - 加密
-(NSString *)encodeString:(NSString *)data :(NSString *)key{
    //    NSData* sampleData = [data dataUsingEncoding:NSUTF8StringEncoding];
    //
    //    NSString * base64String = [sampleData base64EncodedStringWithOptions:0];
    NSLog(@"%@",data);
    NSString *result=[[NSMutableString alloc] init];
    NSInteger keyLength = [key length];
    int position = 0;
    int keyChar = 0;
    int strChar = 0;
    for (int i = 0; i < [data length]; i++) {
        position = i % keyLength;
        strChar = [data characterAtIndex:i];
        keyChar =[key characterAtIndex:position];
        int  ch = strChar ^ keyChar;
        char ca = (char) ch;
        result=[result stringByAppendingString:[NSString stringWithFormat:@"%C",ca]];
    }
    
    NSData* sampleDat1a = [result dataUsingEncoding:NSUTF8StringEncoding];
    
    NSString * base64String1 = [sampleDat1a base64EncodedStringWithOptions:0];
    
    return base64String1;
}

@end
